package com.it00zyq.admin.controller;

import com.it00zyq.admin.service.MailService;
import com.it00zyq.common.utils.R;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author zyq
 * @Date 2022/5/3 11:12
 * @Description TODO
 * @Version 1.0
 **/
@RestController
@RequestMapping("/api/mail")
@RequiredArgsConstructor
public class MailController {

    private final MailService service;

    /**
     * 发送邮件
     * @param subject 邮件主题
     * @param content 邮件内容
     * @param to 收信人邮箱地址
     */
    @GetMapping("/send")
    public R send(String subject, String content, String to) {
        service.sendMail(subject, content, to);
        return R.ok();
    }

}
